/*
* @Author: wanghongfucoder
* @Date:   2017-07-29 11:16:50
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-07-29 15:53:30
*/

#include <iostream>
#include <sstream>
#include <vector>
using namespace std;

int res[7] = {0};
vector<int> splitDot(string s){
	vector<int> v;
    s += '.';
    
    int tmp = -1;
    for(int i=0;i<s.length();i++){
    	if(s[i]>='0' && s[i]<='9'){
    		if(tmp==-1)
    			tmp = 0;
    		tmp = tmp*10 + (s[i]-'0');
    		if(tmp > 255)
    			return v;
    	}else if(s[i]=='.' && tmp != -1){
    		v.push_back(tmp);
    		tmp = -1;
    	}else{
    		return v;
    	}
    }
    return v;
}
void whatType(string ip){
    vector<int> v;
    v = splitDot(ip);
    if(v[0] >=1 && v[0]<=126){
    	res[0]++;
    	if(v[0]==10)
    		res[6]++;
    }else if(v[0] >=128 && v[0]<=191){
    	res[1]++;
    	if(v[0]==172 && v[1]>=16 && v[1] <=31)
    		res[6]++;
    }else if(v[0] >=192 && v[0]<=223){
    	res[2]++;
    	cout<<"ip:"<<ip<<endl;
    	if(v[0]==192 && v[1]==168)
    		res[6]++;
    }
    else if(v[0] >=224 && v[0]<=239){
    	res[3]++;
    }
    else if(v[0] >=240 && v[0]<=255){
    	res[4]++;
    }else{
    	res[5]++;
    }
}
bool isIp(string ip){
   if(ip.length()==0 || ip.length()>15){
        return false;
    }else{

        vector<int> v;
        v = splitDot(ip);
        
        if(v.size()!=4)
        	return false;

        for(int i=0;i<v.size();i++){
        	if(v[i]<0 || v[i]>255)
        		return false;
        }
    } 
    return true;
}

bool isMask(string mask){
    if(mask.length()==0 || mask.length()>15){
        return false;
    }else{
        vector<int> v;
        v = splitDot(mask);
        
        if(v.size()!=4)
        	return false;
        int isContinue = 1;
        for(int i=0;i<v.size();i++){
        	if(i==0 && v[i]==0){
        		return false;
        	}
        	if(isContinue){
	        	if(v[i]==255){
	        		isContinue = 1;
	        	}else if(v[i]==254||v[i]==252||v[i]==248||v[i]==240||v[i]==224||v[i]==192||v[i]==128||v[i]==0){
	        		isContinue = 0;
	        	}else{
	        		return false;
	        	}
	        }else if(isContinue==0){
	        	if(v[i]!=0){
	        		return false;
	        	}
	        }
        }
        return true;
    }
}
int main(){
    string ip_mask;
    while(cin>>ip_mask){
        string ip,mask;
        for(int i=0;i<ip_mask.length();i++){
            if(ip_mask[i]=='~'){
                ip = ip_mask.substr(0,i);
                mask = ip_mask.substr(i+1,ip_mask.length());
                
                break;
            }
        }
        //cout<<"isIp"<<isIp(ip)<<endl;
        //cout<<"isMsk"<<isMask(mask)<<endl;
        if( isIp(ip) && isMask(mask) ){
        	//cout<<"IS"<<endl;
            whatType(ip);

        }else{
            res[5]++;
        }
    }
    for(int i=0;i<6;i++){
        cout<<res[i]<<" ";
    }
    cout<<res[6];
    return 0;
}